import tkinter

from learn2322 import Learn


class MainWindow(object):
    def __init__(self):
        self.root = tkinter.Tk()
        self.root.title("青年大学习")
        self.input_label = tkinter.Label(self.root, text="请输入学习地址")
        # 创建一个输入框,并设置尺寸
        self.url_input = tkinter.Entry(self.root, width=30)

        # 创建一个查询结果的按钮
        self.result_button = tkinter.Button(self.root, command=self.toLearn, text="开始学习")

    def gui_arrang(self):
        self.input_label.pack()
        self.url_input.pack()
        self.result_button.pack()
        tkinter.mainloop()

    def toLearn(self):
        for i in range(100):
            Learn.run(self.url_input.get())
def main():
    MW = MainWindow()
    MW.gui_arrang()


if __name__ == '__main__':
    # for i in range(100):
    #     Learn.run()
    main()
